package com.junlaninfo;

import java.util.Arrays;
import java.util.List;

/**
 * Created by 辉 on 2020/9/14.
 * 测试各个类加载器的文件夹
 */
public class Test1 {
    public static void main(String[] args) {
        bootstrapClassLoader();
    }

    /*
     启动类加载器的加载的文件夹
     */
    public  static  void  bootstrapClassLoader(){
        String property = System.getProperty("sun.boot.class.path");
        List<String> list = Arrays.asList(property.split(","));
       for ( int i=0;i<list.size();i++){
           System.out.println("启动类加载器目录:"+list);
       }
    }

    /**
     * 扩展类加载器
     */
    public static void extClassLoader() {
        String property = System.getProperty("java.ext.dirs");
        List<String> list = Arrays.asList(property.split(";"));
        list.forEach((t) -> {
            System.out.println("扩展类加载器" + t);
        });
    }

    /**
     * app 类加载器
     */
    public static void appClassLoader() {
        String property = System.getProperty("java.class.path");
        List<String> list = Arrays.asList(property.split(";"));
        list.forEach((t) -> {
            System.out.println("应用类加载器" + t);
        });
    }
}
